package com.liss.lissaiagent.rag;


import jakarta.annotation.Resource;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.document.Document;
import org.springframework.ai.transformer.KeywordMetadataEnricher;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: Mr.Li
 * @CreateTime: 2025-10-12
 * @Description: 关键词增强器，元信息
 * @Version: 1.0
 */
@Component
public class MykeywordEnricher {


    @Resource
    private ChatModel dashscopeChatModel;

    @Bean
    public List<Document> enrichDocument(List<Document> documents){
        KeywordMetadataEnricher keywordMetadataEnricher = new KeywordMetadataEnricher(dashscopeChatModel, 5);
        return keywordMetadataEnricher.apply(documents);
    }

}
